# coding=utf-8

__author__ = 'linzh'

from functools import wraps


def time_rec():
    def decorator(f):
        @wraps(f)
        def decorated_function(*args, **kwargs):
            print "begin"
            res = f(*args, **kwargs)
            print "end"
            return res
        return decorated_function
    return decorator

@time_rec()
def print_loop():
    for i in range(0, 41):
        print i

if __name__ == '__main__':
    print_loop()
